﻿#region File Description
//-----------------------------------------------------------------------------
// FinalMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using Microsoft.Xna.Framework;
using kinect_music_shooter.Audio;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
#endregion

namespace kinect_music_shooter
{
    /// <summary>
    /// The pause menu comes up over the top of the game,
    /// giving the player options to resume or quit.
    /// </summary>

    class FinalMenuScreen : MenuScreen
    {
        #region Initialization

        Texture2D snapshot;

        /// <summary>
        /// Constructor.
        /// </summary>
        public FinalMenuScreen(int score, Texture2D pSnapshot)
            : base("Score")
        {
            // Create our menu entries.
            MenuEntry points = new MenuEntry(score.ToString());
            MenuEntry leer1 = new MenuEntry("");
            MenuEntry leer2 = new MenuEntry("");
            MenuEntry quitGameMenuEntry = new MenuEntry("weiter");

            // Hook up menu event handlers.
            quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(points);
            MenuEntries.Add(leer1);
            MenuEntries.Add(leer2);
            MenuEntries.Add(quitGameMenuEntry);

            snapshot = pSnapshot;
        }

        #endregion


        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            Rectangle fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);

            spriteBatch.Begin();
            if (snapshot != null)
            {
                spriteBatch.Draw(snapshot, new Rectangle(viewport.Width/2, viewport.Height/2, 400, 300), new Microsoft.Xna.Framework.Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));
            }

            spriteBatch.End();
            base.Draw(gameTime);
        }


        #region Handle Input

        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen());
        }

        #endregion
    }
}
